package sale.wxb.loveshopping.entity.common;

import lombok.Data;
import sale.wxb.loveshopping.enums.ResponseEnum;

/**
 * 自定义返回异常
 */
@Data
public class ResultException extends RuntimeException {
    private ResponseEnum code;
    private String message;

    public ResultException() {
        super(ResponseEnum.BUSINESS.getMessage());
        code = ResponseEnum.BUSINESS;
        message = code.getMessage();
    }

    public ResultException(ResponseEnum code) {
        super(code.getMessage());
        this.code = code;
        message = code.getMessage();
    }

    public ResultException(String message) {
        super(message);
        code = ResponseEnum.BUSINESS;
        this.message = message;
    }

    public ResultException(ResponseEnum code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }
}
